package com.security.door.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.security.door.core.base.BaseService;
import com.security.door.dao.mapper.baseUsersMapper;
import com.security.door.model.domain.baseUsers;
import com.security.door.model.dto.baseUsersDto;
import com.security.door.service.IbaseUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class baseUsersServiceImpl extends BaseService<baseUsers> implements IbaseUsersService {

    @Autowired
    baseUsersMapper ibaseUserMapper;

    public PageInfo<baseUsers> queryListWithPage(baseUsersDto entity) {
        PageHelper.startPage(entity.getPageIndex(), entity.getPageSize());
        var actionList = ibaseUserMapper.queryListWithPage(entity);
        return new PageInfo<>(actionList);
    }

    @Override
    public boolean checkCode(baseUsers entity) {
        return ibaseUserMapper.checkCode(entity) > 0 ? false : true;
    }

    @Override
    public baseUsers selectByToken(String token){return  ibaseUserMapper.selectByToken(token);}
}
